Skip to content

Comments

Add OpenAPI extension for auto-documenting Restlet applications' APIs#1484

Draft
anicolas wants to merge 6 commits into2.7from
2.7__openapi_extension
Draft

Add OpenAPI extension for auto-documenting Restlet applications' APIs#1484
anicolas wants to merge 6 commits into2.7from
2.7__openapi_extension

Conversation

@anicolas
Copy link
Collaborator

The aim

Add OpenAPI extension for auto-documenting Restlet applications APIs.

The solution

Introduce a new org.restlet.ext.openapi extension that leverages swagger-core and swagger-annotations under-the-hood.

Reproduction

Check-list

  • PR size
    • Under 300 lines ✅
    • Can't be split without complicating the process even more
  • Tests
    • Added
    • Not applicable (why?)
  • Doc
    • Added
    • Not applicable
  • Reviewer
    • Asked for a review
    • Added label DO NOT REVIEW

@anicolas anicolas self-assigned this Feb 13, 2026
Copy link
Collaborator

@jlouvel jlouvel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @anicolas for this significant contribution!

I've left a few comments along the way, also could you add the boilerplate copyright header, including your name as author (additional author if you reused significant code from the older Swagger extension)?

import org.restlet.routing.Filter;
import org.restlet.routing.Router;

public class RestletOpenApiApplication extends Application {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest "OpenApiApplication" as it extends Restlet's Application, which makes it explicit enough


private Paths paths = new Paths();

private OpenAPI openAPI = new OpenAPI();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we rename to "openApi" for consistency within RF?

}
}
} else {
LOGGER.info("Route type ignored: {}", route.getClass());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we access the Logger like other RF code, not directly via SLF4J?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, nice catch, I wasn't aware of this!


import java.util.Optional;

class OpenApiAnnotationProcessor {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we make this class 'public', as well as other classes in the openapi package? That would be consistent with the RF codebase.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, I tried to minimize the public API but let's be consistent!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants